﻿using System;
using System.Collections;
using System.ComponentModel.DataAnnotations;

namespace MvcPresenter.Models.Validators
{
	[AttributeUsage(AttributeTargets.Property, AllowMultiple = true, Inherited = true)]
	public class ListRequiresValidatorAttribute : ValidationAttribute
	{
		public override bool IsValid(object value)
		{
			var list = value as IList;
			if (list == null || list.Count == 0)
				return false;

			return true;
		}
	}
}